﻿@model ShoppingCartSettingsModel
@{
    ViewBag.Title = T("Admin.Configuration.Settings.ShoppingCart").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <i class="fa fa-shopping-cart"></i>
            @T("Admin.Configuration.Settings.ShoppingCart")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="btn btn-warning">
				<i class="fa fa-check"></i>
				<span>@T("Admin.Common.Save")</span>
			</button>
        </div>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
        	// toggle third party email hand over label text
        	$('#@Html.FieldIdFor(model => model.ThirdPartyEmailHandOver)').change(function () {
        		$('#ThirdPartyEmailHandOverTextLocalized').toggle($(this).val() !== '0');
        	}).trigger('change');
        });
    </script>

    Html.RenderAction("StoreScopeConfiguration", "Setting");

    @Html.ValidationSummary(false)
    
    @(Html.SmartStore().TabStrip().Name("catalogsettings-edit").Style(TabsStyle.Material).Items(x =>
     {
         x.Add().Text(T("Admin.Configuration.Settings.ShoppingCart.CartSettings").Text).Content(@TabCartSettings()).Selected(true);
         x.Add().Text(T("Admin.Configuration.Settings.ShoppingCart.Checkout").Text).Content(@TabCheckoutSettings());
         x.Add().Text(T("Admin.Configuration.Settings.ShoppingCart.WishlistSettings").Text).Content(@TabWishlistSettings());
     }))
}

@helper TabCartSettings()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.DisplayCartAfterAddingProduct)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.DisplayCartAfterAddingProduct)
                @Html.ValidationMessageFor(model => model.DisplayCartAfterAddingProduct)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MaximumShoppingCartItems)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.MaximumShoppingCartItems)
                @Html.ValidationMessageFor(model => model.MaximumShoppingCartItems)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowProductImagesOnShoppingCart)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowProductImagesOnShoppingCart)
                @Html.ValidationMessageFor(model => model.ShowProductImagesOnShoppingCart)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowProductBundleImagesOnShoppingCart)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowProductBundleImagesOnShoppingCart)
                @Html.ValidationMessageFor(model => model.ShowProductBundleImagesOnShoppingCart)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowDeliveryTimes)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowDeliveryTimes)
                @Html.ValidationMessageFor(model => model.ShowDeliveryTimes)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowShortDesc)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowShortDesc)
                @Html.ValidationMessageFor(model => model.ShowShortDesc)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowBasePrice)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowBasePrice)
                @Html.ValidationMessageFor(model => model.ShowBasePrice)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowWeight)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowWeight)
                @Html.ValidationMessageFor(model => model.ShowWeight)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowLinkedAttributeValueQuantity)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowLinkedAttributeValueQuantity)
                @Html.ValidationMessageFor(model => model.ShowLinkedAttributeValueQuantity)
            </td>
        </tr>

        <tr>
            <td class="adminSeparator" colspan="2">
                <hr />
            </td>
        </tr>

        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MiniShoppingCartEnabled)
            </td>
            <td class="adminData">
				@Html.SettingEditorFor(model => model.MiniShoppingCartEnabled, Html.CheckBoxFor(model => model.MiniShoppingCartEnabled, new { data_toggler_for = "#pnlShowProductImagesInMiniShoppingCart" }))
                @Html.ValidationMessageFor(model => model.MiniShoppingCartEnabled)
            </td>
        </tr>
		<tr id="pnlShowProductImagesInMiniShoppingCart">
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.ShowProductImagesInMiniShoppingCart)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.ShowProductImagesInMiniShoppingCart)
				@Html.ValidationMessageFor(model => model.ShowProductImagesInMiniShoppingCart)
			</td>
		</tr>
	
        <tr>
			<td class="adminSeparator" colspan="2">
				<hr />
			</td>
        </tr>

        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowDiscountBox)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowDiscountBox)
                @Html.ValidationMessageFor(model => model.ShowDiscountBox)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowGiftCardBox)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowGiftCardBox)
                @Html.ValidationMessageFor(model => model.ShowGiftCardBox)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.CrossSellsNumber)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.CrossSellsNumber)
                @Html.ValidationMessageFor(model => model.CrossSellsNumber)
            </td>
        </tr>
    </table>
}

@helper TabWishlistSettings()
{
    <table class="adminContent">
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.DisplayWishlistAfterAddingProduct)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.DisplayWishlistAfterAddingProduct)
                @Html.ValidationMessageFor(model => model.DisplayWishlistAfterAddingProduct)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
                @Html.ValidationMessageFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.MaximumWishlistItems)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.MaximumWishlistItems)
                @Html.ValidationMessageFor(model => model.MaximumWishlistItems)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowProductImagesOnWishList)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowProductImagesOnWishList)
                @Html.ValidationMessageFor(model => model.ShowProductImagesOnWishList)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowProductBundleImagesOnWishList)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowProductBundleImagesOnWishList)
                @Html.ValidationMessageFor(model => model.ShowProductBundleImagesOnWishList)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.EmailWishlistEnabled)
            </td>
            <td class="adminData">
				@Html.SettingEditorFor(model => model.EmailWishlistEnabled, Html.CheckBoxFor(model => model.EmailWishlistEnabled, new { data_toggler_for = "#pnlAllowAnonymousUsersToEmailWishlist" }))
                @Html.ValidationMessageFor(model => model.EmailWishlistEnabled)
            </td>
        </tr>
        <tr id="pnlAllowAnonymousUsersToEmailWishlist">
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.AllowAnonymousUsersToEmailWishlist)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.AllowAnonymousUsersToEmailWishlist)
                @Html.ValidationMessageFor(model => model.AllowAnonymousUsersToEmailWishlist)
            </td>
        </tr>        
    </table>
}

@helper TabCheckoutSettings()
{
    <table class="adminContent mb-3">
		<tr>
			<td colspan="2">
				<div class="admin-config-group">
					<div class="head">@T("Admin.Configuration.Settings.ShoppingCart.OrderConfirmationPage")</div>
				</div>
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.ShowCommentBox)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.ShowCommentBox)
				@Html.ValidationMessageFor(model => model.ShowCommentBox)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.NewsLetterSubscription)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.NewsLetterSubscription, Html.DropDownListFor(model => model.NewsLetterSubscription, Model.AvailableNewsLetterSubscriptions))
				@Html.ValidationMessageFor(model => model.NewsLetterSubscription)
			</td>
		</tr>
        <tr>
            <td class="adminTitle">
                @Html.SmartLabelFor(model => model.ShowConfirmOrderLegalHint)
            </td>
            <td class="adminData">
                @Html.SettingEditorFor(model => model.ShowConfirmOrderLegalHint)
                @Html.ValidationMessageFor(model => model.ShowConfirmOrderLegalHint)
            </td>
        </tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.ShowEsdRevocationWaiverBox)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.ShowEsdRevocationWaiverBox)
				@Html.ValidationMessageFor(model => model.ShowEsdRevocationWaiverBox)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.ThirdPartyEmailHandOver)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.ThirdPartyEmailHandOver, Html.DropDownListFor(model => model.ThirdPartyEmailHandOver, Model.AvailableThirdPartyEmailHandOver))
				@Html.ValidationMessageFor(model => model.ThirdPartyEmailHandOver)
			</td>
		</tr>
    </table>

	<div id="ThirdPartyEmailHandOverTextLocalized">
		@(Html.LocalizedEditor<ShoppingCartSettingsModel, ShoppingCartSettingsLocalizedModel>("setting-shopping-cart-localized",
		@<table class="adminContent">
			<tr>
				<td class="adminTitle">
					@Html.SmartLabelFor(model => model.Locales[item].ThirdPartyEmailHandOverLabel)
				</td>
				<td class="adminData">
					@*IMPORTANT: Do not delete, this hidden element contains the id to assign localized values to the corresponding language *@
					@Html.HiddenFor(model => model.Locales[item].LanguageId)

					@Html.TextAreaFor(model => Model.Locales[item].ThirdPartyEmailHandOverLabel)
					@Html.ValidationMessageFor(model => model.Locales[item].ThirdPartyEmailHandOverLabel)
				</td>
			</tr>
		</table>
			,
		@<table class="adminContent">
			<tr>
				<td class="adminTitle">
					@Html.SmartLabelFor(model => model.ThirdPartyEmailHandOverLabel)
				</td>
				<td class="adminData">
					@Html.TextAreaFor(model => model.ThirdPartyEmailHandOverLabel)
					@Html.ValidationMessageFor(model => model.ThirdPartyEmailHandOverLabel)
				</td>
			</tr>
		</table>
		))
	</div>
}